package main

import "fmt"

func main() {

	// iota 是常量自动生成器, 每隔一行, 自动累加1, 给常量赋值使用
	const (
		a = iota
		b = iota
		c = iota
	)
	fmt.Printf("a=%d, b=%d, c=%d", a, b, c)

	// iota 遇到 const 就自动重置为0
	const d  = iota
	fmt.Println("\nd=", d)

	// 可以只写一个 iota
	const (
		a1 = iota
		b1
		c1
	)
	fmt.Printf("a=%d, b=%d, c=%d", a1, b1, c1)

	// 如果 iota 位于同一行, 则值都一样
	const (
		i = iota
		j1, j2, j3 = iota, iota, iota
		k = iota
	)

	fmt.Printf("\ni=%d, j1=%d, j2=%d, j3=%d, k=%d", i, j1, j2, j3, k)
}
